import React, {useEffect} from "react";
import EventBus from "./eventBus";
export default function ComponentA() {
    useEffect(() => {
        return ()=>{
            console.log('卸载')
        }
    }, []);
    const handleClick = () => {
        EventBus.emit('myEvent', 'Hello from Component A')
    }
    return (
        <div>
            <h1 onClick={handleClick}>Component A</h1>
        </div>
    )
}
